﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using com.huigo.Framework.ServiceUtils;

namespace com.huigo.B2B.Web.center.order
{
    public partial class UnpaidOrder : BasePage
    {
        private int pageIndex
        {
            get
            {
                return com.loto.Common.TypeParse.StrToInt(Request.QueryString["page"], 1);
            }
        }
        public string Notiy = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        private void BindData()
        {
            List<RequestFuncParams> list = new List<RequestFuncParams>();
            list.Add(new RequestFuncParams("custFid", CustId.ToString()));
            list.Add(new RequestFuncParams("pageSize", pageInfo.PageSize.ToString()));
            list.Add(new RequestFuncParams("pageIndex", pageIndex.ToString()));
            BaseService service = new BaseService();
            ParserXml parser = service.RequestEntryService(Dict.ERequestFunc.GET_UNPAID_ORDER_LIST, list);
            if (parser != null && parser.RowsCount > 0)
            {
                pageInfo.RecordCount = Convert.ToInt16(parser["RecordCount", 0]);
                pageInfo.CurrentPageIndex = pageIndex;
                pageInfo.PageURLFormat = GetPagerUrl();
                OrderListContent.DataSource = parser.ModelList;
                OrderListContent.DataBind();
            }
            else
            {
                Notiy = "<table width=\"100%\" class=\"table table-bordered table-striped responsive-utilities table-hover\"><thead><tr><td>订单号</td><td>保险名称</td><td>被保人数</td><td>订单金额</td><td>订单时间</td><td>订单状态</td><td>操作</td></tr></thead><tbody><tr><td colspan=\"7\" style=\"text-align:center;\">没有相关信息</td></tr></tbody></table>";
            }
        }
        private string GetPagerUrl()
        {
            string url = "UnpaidOrder.aspx?page={0}";            
           
            return url;
        }

        protected void pageInfo_PageChanged(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindData();
            }
        }
    }
}
